using UnityEngine;

namespace IQIGame.Onigao.Framework
{
    public class ProjectSettingManager : FrameMonoModule
    {
        /// <summary>
		/// 构建版本信息
		/// </summary>
		[SerializeField]
        private BuildInfo m_BuildInfo = null;
        /// <summary>
        /// 是否是提审模式
        /// </summary>
        [HideInInspector]
        public bool AuditMode = false;

#if UNITY_EDITOR
        public static BuildInfo BuildInfoWithEditor()
        {
            GameObject projectSetting = GameObject.Find("GameLaunch/Framework/ProjectSetting");
            ProjectSettingManager projectSettingManager = projectSetting.GetComponent<ProjectSettingManager>();
            return projectSettingManager.BuildInfo;
        }
#endif

        public BuildInfo BuildInfo
        {
            get
            {
                return m_BuildInfo;
            }
        }

        public void SetBuildInfo(BuildInfo info)
        {
            m_BuildInfo = info;
        }

        public bool IsSDKMode()
        {
            return m_BuildInfo.SDKName != "Builtin" && m_BuildInfo.SDKName != "Admin";
        }

        protected override void OnInit()
        {
            if (m_BuildInfo == null)
            {
                Debug.LogError("BuildInfo asset is null.");
                return;
            }
        }

        protected override void OnEnterGame()
        {
        }

        protected override void OnShutdown()
        {
        }
    }
}
